how to convert object into array